// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import App from './App';
// 路由
import router from './router';
import StoreConfig from './config/StoreConfig';
import FastClick from 'fastclick';
// 引入所有公有css
import './config/StyleConfig';
// 引入全局常量
import GlobalConstant from './util/GlobalConstant';
// 引入vue的原型配置
import PrototypeConfig from './config/PrototypeConfig';
// 引入注册组件配置
import ComponentConfig from './config/ComponentConfig.js';
// 引入网络配置
import NetworkConfig from './config/NetworkConfig';
// 引入定位配置
// import LocationConfig from './config/LocationConfig';
// 使用插件iscroll
import VueScroll from 'vue-infinite-scroll';
  Vue.use(VueScroll);
// 原型初始化
PrototypeConfig.createPrototype(Vue);
// 组件初始化
ComponentConfig.createComponent(Vue);

Vue.config.productionTip = false;

// 解决移动端点击延迟
FastClick.attach(document.body);

GlobalConstant.router = router.router();

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router: GlobalConstant.router,
  store: StoreConfig.initStore(),
  template: '<App/>',
  components: {App},
  created() {
    // 网络请求初始化
    NetworkConfig.createNetwork(this);
  },
  mounted() {
    // 定位初始化
    document.addEventListener('DOMContentLoaded', function (e) {
      // xrem => ypx       x*100/2 = y
      // xpx => yrem       x*2/100 = y
      // document.getElementsByTagName('html')[0].style.fontSize = window.innerWidth * 2 / 15 + 'px';
    }, false);
    // LocationConfig.appPickLocation().then((data) => {
    // }, (error) => {
    //   console.log(error);
    // });
  }
})
